package com.ldp.designpatterns.review.structure.adapter.interfaceAdapter.adapter;

import com.ldp.designpatterns.review.structure.adapter.classAdapter.target.Volatege110V;
import com.ldp.designpatterns.study.adapter.BeanAdapter.target.adaptee.Volatage220V;

/**
 * @ClassName ClassAdapter
 * @Description TODO 适配器模式——类适配器：第3步：类转换适配器 继承extends和实现implements,把220V转换成110V
 * @Author lindipei
 * @Date 2023/10/20 15:36
 */
public class InterfaceAdapter implements Volatege110V {

    private Volatage220V volatage220V;

    public InterfaceAdapter(Volatage220V volatage220V){
        this.volatage220V = volatage220V;
    }
    @Override
    public int output110V() {
        int output = volatage220V.output220V();
        return (output / 2);
    }
}
